import React from 'react'
import { NavBar } from 'antd-mobile'
import { withRouter } from 'react-router-dom'
import PropTpyes from 'prop-types'

// import './index.scss'
import styles from './index.module.css'
function NavHeader({ children, history, onLeftClick }) {
  const defaultHanlder = () => history.go(-1)
  return (
    <NavBar
      className={styles.navBar}
      mode="light"
      icon={<i className="iconfont icon-back" />}
      onLeftClick={onLeftClick || defaultHanlder}
    >{children}</NavBar>
  )
}

NavHeader.propTypes = {
  children: PropTpyes.string.isRequired,
  onLeftClick: PropTpyes.func
}
export default withRouter(NavHeader)

